package com.itheima.mapper;

import com.itheima.entity.AttrKey;
import com.itheima.entity.Config;
import com.itheima.entity.PartConfig;
import com.itheima.entity.Validator;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysConfigMapper {
    /**
     * 选择 “系统配置”
     *
     * @return {@link List}<{@link Config}>
     */
    @Select("select id, group_value, tab_value, attr_key, attr_name, attr_value, del_flag, type, config_value, " +
            "validator, placeholder, can_delete, sort_num from sys_config")
    List<Config> selectSysConfig();

    /**
     * 按组值选择
     *
     * @param groupValue 组值
     * @return {@link List}<{@link Config}>
     */
    List<Config> selectByGroupValue(String groupValue);

    /**
     * 部分查询
     *
     * @return {@link List}<{@link Config}>
     */
    List<PartConfig> partialQuery();

    /**
     * 选择attr键
     *
     * @return {@link List}<{@link String}>
     */
    @Select("select attr_key,attr_value from sys_config")
    List<AttrKey> selectAttrKey();

    /**
     * 选择验证程序
     *
     * @return {@link List}<{@link String}>
     */
    List<Validator> selectValidator();
}
